package cumt.oj;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @Author Fizz Pu
 * @Date 2020/11/6 下午3:02
 * @Version 1.0
 * 失之毫厘，缪之千里！
 */

// 循环变量忘记初始化
// flag = 1

public class problem2 {
    static char[][] dp = new char[26][26];
    static {
        char start = 'A';
        int count= 0;
        for(int i = 0;i < 26; ++i){
            int temp = start;
            char row = 'A';
            for(int j = 0;j < 26; ++j){
                if(temp > 'Z')temp = 'A';
                dp[temp-'A'][count] = row;
                temp++;
                row++;
            }
            count++;
            start++;
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String key = scanner.next();
        String encry = scanner.next();
        if(key.length() == 0 || encry.length() == 0){
            System.out.println("");
        }

        int encrypoint = 0;
        int keyPoint = 0;
        int flag = 0;
        StringBuilder sb = new StringBuilder();
        while (encrypoint < encry.length()){
            flag = 0;
            if(keyPoint >= key.length()) keyPoint=0;
            char enChar = encry.charAt(encrypoint);
            char keyChar = key.charAt(keyPoint);
            if( 'a' <= enChar && enChar <= 'z'){
                enChar =  (char)(enChar - 32);
                flag = 1;
            }
            if( 'a' <= keyChar && keyChar <= 'z'){
                keyChar =  (char)(keyChar - 32);
            }
            char target = dp[enChar - 'A'][keyChar-'A'];
            if(flag == 1){
                target = (char) (target + 32);
            }
            sb.append(target);
            encrypoint++;
            keyPoint++;
        }
        System.out.println(sb.toString());
    }
}
